package com.yz.pojo;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;


public class Blog {
    private Integer blogId;
    private String blogTitle;
    private String blogCoverImage;
    private String blogContent;
    private Integer blogCategoryId;
    private String blogCategoryName;
    private String blogTags;
    private Integer blogStatus;
    private Integer blogViews;
    private Integer enableComment;
    private Date createTime;

    public String getCreateTime(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(this.createTime);
    }

    // 获取创建时间---年月日
    public String getAboutTime(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        return simpleDateFormat.format(this.createTime);
    }

    public Integer getBlogId() {
        return blogId;
    }

    public void setBlogId(Integer blogId) {
        this.blogId = blogId;
    }

    public String getBlogTitle() {
        return blogTitle;
    }

    public void setBlogTitle(String blogTitle) {
        this.blogTitle = blogTitle;
    }

    public String getBlogCoverImage() {
        return blogCoverImage;
    }

    public void setBlogCoverImage(String blogCoverImage) {
        this.blogCoverImage = blogCoverImage;
    }

    public String getBlogContent() {
        return blogContent;
    }

    public void setBlogContent(String blogContent) {
        this.blogContent = blogContent;
    }

    public Integer getBlogCategoryId() {
        return blogCategoryId;
    }

    public void setBlogCategoryId(Integer blogCategoryId) {
        this.blogCategoryId = blogCategoryId;
    }

    public String getBlogCategoryName() {
        return blogCategoryName;
    }

    public void setBlogCategoryName(String blogCategoryName) {
        this.blogCategoryName = blogCategoryName;
    }

    public String getBlogTags() {
        return blogTags;
    }

    public void setBlogTags(String blogTags) {
        this.blogTags = blogTags;
    }

    public Integer getBlogStatus() {
        return blogStatus;
    }

    public void setBlogStatus(Integer blogStatus) {
        this.blogStatus = blogStatus;
    }

    public Integer getBlogViews() {
        return blogViews;
    }

    public void setBlogViews(Integer blogViews) {
        this.blogViews = blogViews;
    }

    public Integer getEnableComment() {
        return enableComment;
    }

    public void setEnableComment(Integer enableComment) {
        this.enableComment = enableComment;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Blog() {
    }

    public Blog(Integer blogId, String blogTitle, String blogCoverImage, String blogContent, Integer blogCategoryId, String blogCategoryName, String blogTags, Integer blogStatus, Integer blogViews, Integer enableComment, Date createTime) {
        this.blogId = blogId;
        this.blogTitle = blogTitle;
        this.blogCoverImage = blogCoverImage;
        this.blogContent = blogContent;
        this.blogCategoryId = blogCategoryId;
        this.blogCategoryName = blogCategoryName;
        this.blogTags = blogTags;
        this.blogStatus = blogStatus;
        this.blogViews = blogViews;
        this.enableComment = enableComment;
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Blog blog = (Blog) o;
        return Objects.equals(blogId, blog.blogId) &&
                Objects.equals(blogTitle, blog.blogTitle) &&
                Objects.equals(blogCoverImage, blog.blogCoverImage) &&
                Objects.equals(blogContent, blog.blogContent) &&
                Objects.equals(blogCategoryId, blog.blogCategoryId) &&
                Objects.equals(blogCategoryName, blog.blogCategoryName) &&
                Objects.equals(blogTags, blog.blogTags) &&
                Objects.equals(blogStatus, blog.blogStatus) &&
                Objects.equals(blogViews, blog.blogViews) &&
                Objects.equals(enableComment, blog.enableComment) &&
                Objects.equals(createTime, blog.createTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(blogId, blogTitle, blogCoverImage, blogContent, blogCategoryId, blogCategoryName, blogTags, blogStatus, blogViews, enableComment, createTime);
    }

    @Override
    public String toString() {
        return "Blog{" +
                "blogId=" + blogId +
                ", blogTitle='" + blogTitle + '\'' +
                ", blogCoverImage='" + blogCoverImage + '\'' +
                ", blogContent='" + blogContent + '\'' +
                ", blogCategoryId=" + blogCategoryId +
                ", blogCategoryName='" + blogCategoryName + '\'' +
                ", blogTags='" + blogTags + '\'' +
                ", blogStatus=" + blogStatus +
                ", blogViews=" + blogViews +
                ", enableComment=" + enableComment +
                ", createTime=" + createTime +
                '}';
    }
}
